home *** CD-ROM | disk | FTP | other *** search
/ Loadstar 1 / 001.d81 / french military (.txt) < prev    next >
Commodore BASIC  |  2022-08-26  |  8KB  |  283 lines

  1. 1 dimv(11),h(11):printchr$(142)
  2. 5 for a=1to11:readv(a),h(a):next
  3. 10 data 6,3,1,11,6,11,11,11
  4. 11 data 1,19,6,19,11,19
  5. 12 data 1,27,6,27,11,27,6,35
  6. 15 z$=""
  7. 20 poke53281,6:poke53280,15:print""
  8. 50 :
  9. 60 :
  10. 100 def fnp(x)=2^(x-1)
  11. 200 dims(165),r(30,2),l(11,11),w(3),a(165,11)
  12. 300 rem  french military game, sixth book of mathematical games from scientific
  13. 305 rem american by martin gardner
  14. 400 rem  incorporates match. learning from unexpected hanging by martin gardner
  15. 500 rem  programmed by g.h. herd sept.78 published in creative computing sept.79
  16. 600 print"[147]"
  17. 700 print"";
  18. 808 print"the french military game"
  19. 900 print
  20. 1000 print"";
  21. 1100 print"  by  martin gardner"
  22. 1200 print:print"<revised by alan gardner for the c-64>"
  23. 1250 print"do you need instructions?";:poke198,0:wait198,1:getin$
  24. 1260 ifin$="y" or in$="n"then1275
  25. 1265 print"please enter y/n":goto700
  26. 1275 print"[147]loading data....please wait"
  27. 1300 forl=1to9
  28. 1400 letl1=fnp(l)
  29. 1500 form=l+1to10
  30. 1600 letm1=fnp(m)
  31. 1700 forr=m+1to11
  32. 1880 lets(i)=l1+m1+(fnp(r))
  33. 1900 leti=i+1
  34. 2000 nextr
  35. 2100 nextm
  36. 2200 nextl
  37. 2300 remprint"[147]"
  38. 2305 print""
  39. 2310 remnt"do you need instructions";
  40. 2315 reminputin$:print"[147]"
  41. 2320 ifleft$(in$,1)<>"n"thengosub18100
  42. 2400 rem  load up learning curve
  43. 2500 rem  disk command "load data #5,34,a
  44. 2600 [129]i[178]1[164]30
  45. 2700 [129]j[178]1[164]2
  46. 2800 [136]r(i,j)[178]0
  47. 2900 [130]j
  48. 3000 [130]i
  49. 3100 [129]i[178]1[164]11
  50. 3200 [129]j[178]1[164]11
  51. 3300 [135]l(i,j)
  52. 3400 [130]j
  53. 3500 [130]i
  54. 3600 [143]  l(i.j)=0 means move i      to j not legal
  55. 3700 [143]  l(i,j)=1 means move i      to j legal black only
  56. 3800 [143]  l(i,j)=2 means move i      to j legal for both
  57. 3900 [143]
  58. 4000 [136]b[178]6
  59. 4100 [136]w(1)[178]1
  60. 4200 [136]w(2)[178]2
  61. 4300 [136]w(3)[178]4
  62. 4400 [136]i0[178]1
  63. 4500 [141]11000
  64. 4600 [141]15000
  65. 4700 [143]  main program loop
  66. 4800 :
  67. 4850 :
  68. 4860 :
  69. 4870 :
  70. 4880 [153]z$;"white pieces are at ";w(1);" ";w(2);" ";w(3)"  "
  71. 4900 [153]"the black piece is at ";b"  "
  72. 5000 [153]"your move, from-to x,y        cmdcmdcmdcmdcmdcmdcmd";
  73. 5100 [133]x,y
  74. 5200 [139]x[178]0[175]y[178]0[167]7800
  75. 5300 [143]  was it a legal move
  76. 5400 [141]9100
  77. 5500 [139]l2[178]1[167]5800
  78. 5600 [153]"foul !!!!! try again."
  79. 5700 [137]4800
  80. 5800 [143]  legal move - what is   white position index (s3)
  81. 5900 [153]"":p$[178]"  cmdcmd  "
  82. 5905 [145]x[141]17000,17100,17200,17300,17400,17500,17600,17700,17800,17900,18000
  83. 6000 [153]"":p$[178]"  cmdcmd  wait"
  84. 6005 [145]y[141]17000,17100,17200,17300,17400,17500,17600,17700,17800,17900,18000
  85. 6100 [141]11000
  86. 6200 [139]i0[179][178]19[167]6600
  87. 6300 [153]"that's 20 moves, ace, and you haven't   trapped me."
  88. 6400 [137]7800
  89. 6500 [143]  what is black's best        move  -  if any
  90. 6600 [141]11600
  91. 6700 [139]m4[178]0[167]8100
  92. 6800 [143]  computer moves
  93. 6900 [153]z$;:[153]"                          ":[153]z$"oni move to ";m4
  94. 7000 [153]"":p$[178]"  cmdcmd  "
  95. 7005 [145]b[141]17000,17100,17200,17300,17400,17500,17600,17700,17800,17900,18000
  96. 7100 [153]"":p$[178]"stop  cmdcmd  wait"
  97. 7105 [145]m4[141]17000,17100,17200,17300,17400,17500,17600,17700,17800,17900,18000
  98. 7150 [153]z$
  99. 7200 [136]r(i0,1)[178]s3
  100. 7308 [136]r(i0,2)[178]m4
  101. 7400 [136]b[178]m4
  102. 7500 [136]i0[178]i0[170]1
  103. 7608 [139]b[179][177]1[167]4700
  104. 7700 [143]  here only if machine wins
  105. 7800 [153]z$"i win......"
  106. 7900 [136]w[178]1
  107. 8000 [137]8300
  108. 8100 [153]z$"i lost......"
  109. 8200 [136]w[178][171]1
  110. 8300 [143]  update array a
  111. 8400 [141]13000
  112. 8500 [153]"want to play again";
  113. 8600 [133]e$
  114. 8700 [139][200](e$,1)[178]"y"[167]4000
  115. 8800 [139][200](e$,1)[178]"n"[167]9000
  116. 8900 [153]"please answer y or n":[153]:[137]8500
  117. 9000 [143] ***** text *****
  118. 9005 [151]198,0
  119. 9010 [153]"load"
  120. 9015 [153]""
  121. 9020 [153]"";
  122. 9025 [153]"* * * the  end * * *"
  123. 9030 [153]""
  124. 9035 [137] 63000
  125. 9100 [143]  check whites move for        legalivy
  126. 9200 [136]l2[178][171]1
  127. 9308 [129]i2[178]1[164]3
  128. 9400 [136]j2[178]i2
  129. 9500 [139]w(i2)[178]x[167]9900
  130. 9600 [130]i2
  131. 9700 [143]  no white piece at x
  132. 9800 [137]10900
  133. 9900 [143] if black is at y then illegal
  134. 10000 [139]b[178]y[167]10900
  135. 10100 [143]  illegal if white at y
  136. 10200 [129]i2[178]1[164]3
  137. 10300 [139]w(i2)[178]y[167]10900
  138. 10400 [130]i2
  139. 10500 [139]l(x,y)[179][177]2[167]10900
  140. 10600 [143]  legal move for white
  141. 10700 [136]w(j2)[178]y
  142. 10800 [136]l2[178]1
  143. 10900 [142]
  144. 11000 [143]  calculate new white         position number
  145. 11100 [136]a3[178][165]p(w(1))[170][165]p(w(2))[170][165]p(w(3))
  146. 11200 [129]s3[178]1[164]165
  147. 11300 [139]s(s3)[178]a3[167]11500
  148. 11400 [130]s3
  149. 11500 [142]
  150. 11600 [143]  pick black's best move
  151. 11700 [136]m4[178]0
  152. 11800 [129]i4[178]1[164]11
  153. 11900 [139]l(b,i4)[178]0[167]12800
  154. 12000 [143]  occupied by white?
  155. 12100 [129]j4[178]1[164]3
  156. 12200 [139]w(j4)[178]i4[167]12800
  157. 12300 [130]j4
  158. 12400 [139]m4[178]0[167]12700
  159. 12500 [139]a(s3,m4)[177][178]a(s3,i4)[167]12800
  160. 12600 [143]  new best move
  161. 12700 [136]m4[178]i4
  162. 12800 [130]i4
  163. 12900 [142]
  164. 13000 [143]  update at game end
  165. 13100 [129]i6[178]1[164]i0[171]1
  166. 13200 [136]s[178]r(i6,1)
  167. 13300 [136]m[178]r(i6,2)
  168. 13400 [136]a(s,m)[178]a(s,m)[170]w
  169. 13500 [130]i6
  170. 13600 [142]
  171. 13700 [143]  data for l array
  172. 13800 [131]  0,2,2,2,0,0,0,0,0,0,0
  173. 13900 [131]  1,0,2,0,2,2,0,0,0,0,0
  174. 14000 [131]  1,2,0,2,0,2,0,0,0,0,0
  175. 14100 [131]  1,0,2,0,0,2,2,0,0,0,0
  176. 14200 [131]  0,1,0,0,0,2,0,2,0,0,0
  177. 14300 [131]  0,1,1,1,2,0,2,2,2,2,0
  178. 14400 [131]  0,0,0,1,0,2,0,0,0,2,0
  179. 14500 [131]  0,0,0,0,1,1,0,0,2,0,2
  180. 14600 [131]  0,0,0,0,0,1,0,2,0,2,2
  181. 14700 [131]  0,0,0,0,0,1,1,0,2,0,2
  182. 14800 [131]  0,0,0,0,0,0,0,2,2,2,0
  183. 15000 [143]  draw board
  184. 15100 [153]"load"
  185. 15225 [153]"          print2spc(spc(spc(    print5spc(spc(spc(    print8spc(spc(spc(
  186. 15250 print"          [166]  [166][164][164][164][164][166]  [166][164][164][164][164][166]  [166]
  187. 15300 [153]"          spc(  spc(    spc(  spc(    spc(  spc(
  188. 15400 print"         [206][166][166][166][166][205]   [166][166][166][166]   [206][166][166][166][166][205]
  189. 15500 [153]"        (NULL)  then   (NULL)   then    (NULL)  then   (NULL)
  190. 15600 print"  [153]1[166][166][166] [206]  [153]3[166][166][166]  [205] [153]6[166][166][166] [206]  [153]9[166][166][166]  [205] [153]11[166][166]
  191. 15700 [153]"  spc(  spc((NULL)tototospc(  spc(tototo(NULL)spc(  spc((NULL)tototospc(  spc(tototo(NULL)spc(  spc(
  192. 15800 print"  [166]  [166][205]   [166]  [166]   [206][166]  [166][205]   [166]  [166]   [206][166]  [166]
  193. 15900 [153]"  spc(spc(spc(spc( (NULL)  spc(spc(spc(spc(  (NULL) spc(spc(spc(spc( (NULL)  spc(spc(spc(spc(  (NULL) spc(spc(spc(spc(
  194. 16000 print"        [205]  [167]   [206]   [167]    [205]  [167]   [206]
  195. 16100 [153]"         (NULL)print4spc(spc(spc((NULL)   print7spc(spc(spc(   (NULL)print10spc(spc((NULL)
  196. 16200 print"          [166]  [166][164][164][164][164][166]  [166][164][164][164][164][166]  [166]
  197. 16300 [153]"          spc(  spc(    spc(  spc(    spc(  spc(
  198. 16400 print"          [166][166][166][166]    [166][166][166][166]    [166][166][166][166]
  199. 16500 p$[178]"  cmdcmd  ":[153]"":[141]17000:[153]"":[141]17100:[153]"":[141]17300
  200. 16600 p$[178]"stop  cmdcmd  ":[153]"":[141]17500
  201. 16800 [142]
  202. 16900 [143]  square 1
  203. 17000 [129]v[178]1[164]v(1):[153]"";:[130]:[129]h[178]1[164]h(1):[153]"";:[130]:[153]p$:[142]
  204. 17100 [129]v[178]1[164]v(2):[153]"";:[130]:[129]h[178]1[164]h(2):[153]"";:[130]:[153]p$:[142]
  205. 17200 [129]v[178]1[164]v(3):[153]"";:[130]:[129]h[178]1[164]h(3):[153]"";:[130]:[153]p$:[142]
  206. 17300 [129]v[178]1[164]v(4):[153]"";:[130]:[129]h[178]1[164]h(4):[153]"";:[130]:[153]p$:[142]
  207. 17400 [129]v[178]1[164]v(5):[153]"";:[130]:[129]h[178]1[164]h(5):[153]"";:[130]:[153]p$:[142]
  208. 17500 [129]v[178]1[164]v(6):[153]"";:[130]:[129]h[178]1[164]h(6):[153]"";:[130]:[153]p$:[142]
  209. 17600 [129]v[178]1[164]v(7):[153]"";:[130]:[129]h[178]1[164]h(7):[153]"";:[130]:[153]p$:[142]
  210. 17700 [129]v[178]1[164]v(8):[153]"";:[130]:[129]h[178]1[164]h(8):[153]"";:[130]:[153]p$:[142]
  211. 17800 [129]v[178]1[164]v(9):[153]"";:[130]:[129]h[178]1[164]h(9):[153]"";:[130]:[153]p$:[142]
  212. 17900 [129]v[178]1[164]v(10):[153]"";:[130]:[129]h[178]1[164]h(10):[153]"";:[130]:[153]p$:[142]
  213. 18000 [129]v[178]1[164]v(11):[153]"";:[130]:[129]h[178]1[164]h(11):[153]"